package com.zengqingfa.examples.mybatisplus.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zengqingfa.examples.mybatisplus.entity.User;
import com.zengqingfa.examples.mybatisplus.entity.UserHistory;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @fileName: UserMapper
 * @author: zengqf3
 * @date: 2020-8-1 14:12
 * @description:
 */

public interface UserHistoryMapper extends BaseMapper<UserHistory> {

    /**
     * 分页查看
     * @param page
     * @param userHistory
     * @return
     */
    IPage<UserHistory> selectPage(Page<UserHistory> page, @Param("param") UserHistory userHistory);

    /**
     * 通过id查询
     *
     * @return
     */
    @Select("select * from user_history where id =#{id}")
    UserHistory selectById(@Param("id") Long id);

    /**
     * 通过userId查询
     *
     * @return
     */
    @Select("select * from user_history where user_id =#{userId}")
    IPage<UserHistory> selectByUserId(@Param("userId") Long userId);
}
